package com.lewis.core.base.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lewis.core.base.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 菜单权限表 sys_menu
 *
 * @author Lewis
 */
@ApiModel("菜单权限表 sys_menu")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysMenu extends BaseEntity {

	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "菜单ID")
	@TableId(value = "id", type = IdType.AUTO)
	private Long id;

	@ApiModelProperty(value = "菜单名称")
	@NotBlank(message = "菜单名称不能为空")
	@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
	private String menuName;

	@ApiModelProperty(value = "父菜单名称")
	@TableField(exist = false)
	private String parentName;

	@ApiModelProperty(value = "父菜单ID")
	private Long parentId;

	@ApiModelProperty(value = "显示顺序")
	@NotBlank(message = "显示顺序不能为空")
	private String orderNum;

	@ApiModelProperty(value = "路由地址")
	@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
	private String path;

	@ApiModelProperty(value = "组件路径")
	@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
	private String component;

	@ApiModelProperty(value = "是否为外链（0是 1否）")
	private String isFrame;

	@ApiModelProperty(value = "是否缓存（0缓存 1不缓存）")
	private String isCache;

	@ApiModelProperty(value = "类型（M目录 C菜单 F按钮）")
	@NotBlank(message = "菜单类型不能为空")
	private String menuType;

	@ApiModelProperty(value = "显示状态（0显示 1隐藏）")
	private String visible;

	@ApiModelProperty(value = "菜单状态（0显示 1隐藏）")
	private String status;

	@ApiModelProperty(value = "菜单图标")
	private String icon;

	@ApiModelProperty(value = "子菜单")
	@TableField(exist = false)
	private List<SysMenu> children = new ArrayList<SysMenu>();

	@ApiModelProperty(value = "创建者")
	private String createBy;

	@ApiModelProperty(value = "创建时间")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;

	@ApiModelProperty(value = "更新者")
	private String updateBy;

	@ApiModelProperty(value = "更新时间")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date updateTime;

	@ApiModelProperty(value = "备注")
	private String remark;
}
